/******************************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Ltd.                       */
/*                                                                            */
/*  NAME      = informix_common.h                                             */
/*  NOTE      =                                                               */
/*  DATE      = 2015/08/26 by zhengxd                                         */
/******************************************************************************/
#ifndef _INFORMIX_COMMON_H_
#define _INFORMIX_COMMON_H_

#include "informix_core.h"

#define INFORMIX_DIRECT_REQUEST     1
#define INFORMIX_DIRECT_RESPONSE    2

void informix_free(char **pp_buffer);

void informix_init_fragment(L7_fragment_informix *p_st_fragment);

void informix_destroy_fragment(L7_fragment_informix **pp_st_fragment);

Frreport_body_data* informix_new_report_body(Conntrack *p_st_conn
                                            , L7session_informix *p_st_sess);

L7_req_informix* informix_create_request(void);

void informix_destroy_session(L7session_informix **pp_st_sess);

void informix_int_request(L7_req_informix *p_st_req);

void informix_destroy_request(L7_req_informix **pp_st_req);

void informix_int_response(L7_resp_informix *p_st_resp);

void informix_destroy_response(L7_resp_informix **pp_st_resp);

void informix_destroy_curr_info(L7session_informix_private *p_st_private);

Frreport_body_data* informix_new_report_body(Conntrack *p_st_conn
                                            , L7session_informix *p_st_sess);

int informix_merge_string(char *p_first_str
                          , char *p_second_str
                          , char **pp_merge_str);

int informix_read_chars(Frbyte_Packet *p_st_data
                        , int i_get_flg
                        , char **pp_output);

int informix_read_padded(Frbyte_Packet *p_st_data
                        , unsigned int ui_length
                        , char **pp_output
                        , unsigned int *p_ui_out_size);

int informix_skip_bytes(Frbyte_Packet *p_st_data, unsigned int ui_length);

int informix_skip_padded(Frbyte_Packet *p_st_data
                        , unsigned int ui_length);

int informix_get_2byte_padded(Frbyte_Packet *p_st_data
                             , char **pp_output
                             , unsigned int *p_ui_out_size);

int informix_get_4byte_padded(Frbyte_Packet *p_st_data
                             , char **pp_output
                             , unsigned int *p_ui_out_size);

int informix_skip_2byte_padded(Frbyte_Packet *p_st_data);

int informix_skip_4byte_padded(Frbyte_Packet *p_st_data);

int informix_add_statement(L7session_informix_private *p_st_private);

void informix_free_param(Frdata_field **pp_st_value);

int informix_parse_blob(Conntrack *p_st_conn
                        , L7session_informix_private *p_st_private);

#endif
